//
// Created by lfm on 25-4-16.
//
#include <iostream>
#include <vector>
using namespace std;

void PrintVector(vector<int> & v)
{
    for (vector<int>::iterator it = v.begin(); it != v.end(); it ++)
    {
        cout << *it << " ";
    }
    cout << endl;
}

void test01()
{
    vector<int> v1;
    for (int i = 0; i < 10; i++)
    {
        v1.push_back(i);
    }
    if (v1.empty())
    {
        cout << "容器空" << endl;
    }
    else
    {
        cout << "容器容量为:" << v1.capacity() << endl;;
        cout << "容器大小为:" << v1.size() << endl;
    }
    //重新指定大小
    //如果比原来长,默认用0来填充
    v1.resize(15, 100);
    PrintVector(v1);
    //如果重新制定比原来短，，超出部分会删除
    v1.resize(5);
    PrintVector(v1);

}

int main()
{
    test01();
    return 0;
}